package org.luxor.eshop.payment.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.luxor.commons.core.utils.DateUtils;
import org.luxor.commons.core.validator.group.UpdateGroup;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;


/**
 * 支付记录
 *
 * @author administrator @date 2020-12-04 15:55:08
 */
@Data
@TableName("tb_payment")
@ApiModel(description = "支付记录")
public class PaymentEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键Id")
    @JSONField(serializeUsing = ToStringSerializer.class)
    @NotNull(message = "paymentId，不能为空", groups = UpdateGroup.class)
    private Long paymentId;

    @NotBlank(message = "买家账户，不能为空")
    @ApiModelProperty(value = "买家账户")
    private String buyerAccount;

    @NotBlank(message = "卖家账户，不能为空")
    @ApiModelProperty(value = "卖家账户")
    private String sellerAccount;

    @NotNull(message = "支付金额，不能为空")
    @ApiModelProperty(value = "支付金额")
    private BigDecimal amounts;

    @ApiModelProperty(value = "订单ID")
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long orderId;

    @ApiModelProperty(value = "付款完成时间")
    @JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN, timezone = "GMT+8")
    private Date payTime;

}
